package com.kitty.game.fight.reward;

import com.kitty.game.pet.model.Pet;
import com.kitty.game.role.model.Role;
import com.kitty.game.fight.bean.Fight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

public abstract class FightRewardHandler {

    protected final Logger logger = LoggerFactory.getLogger(FightRewardHandler.class);

    private static final Map<Integer, FightRewardHandler> handlers = new HashMap<>();

    @PostConstruct
    public void init() {
        handlers.put(getType(), this);
    }

    public static FightRewardHandler queryHandler(int type) {
        return handlers.get(type);
    }

    /**
     * 	胜利发奖
     * @param fight
     * @param role
     */
    public abstract void sendReward(Fight fight, Role role , Pet pet);

    public abstract void fightFailed(Fight fight, Role role);

    public abstract void flee(Fight fight,Role role);

    public abstract int getType();

}
